package service;

import java.sql.SQLException;
import java.util.List;

import mapper.ProductMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import action.form.ProductAddActionForm;
import entity.Product;

@Service("ProductServiceImpl")
public class ProductServiceImpl implements ProductService{

	@Autowired
	private ProductMapper productMapper;
	
	@Override
	public List<Product> selectProductList() throws SQLException {
		return productMapper.selectProductList();
	}

	@Override
	public void deleteProduct(int productId) throws SQLException {
		productMapper.deleteProduct(productId);
	}
	
	@Override
	public void insertProduct(ProductAddActionForm productActionForm) throws SQLException {
		Product product = new Product();
		product.setProductName(product.getProductName());
		product.setProductPrice(productActionForm.getPrice());
		product.setProductDescription(product.getProductDescription());
		productMapper.insertProduct(product);
	}

}
